extends "../cex___zahuopu-Hide/item.gd"

var n = 0
var ch
var ItemData = preload("./itemData.gd").getCharaData()

func _init():
	._init()

func init():
	.init()
	name = ItemData.NAME
	type = config.EQUITYPE_EQUI
	attInit()
	price = 0
	info = ItemData.INFO_TEXT
	info += sys.rndListItem(adlist).format({"0":sys.rndListItem(adcolour),"1":sys.rndListItem(adprice)})

func _connect():
	if masCha.team !=1:return 
	if masCha.lv > 3:return
	if masCha.id.find("cex")>=0 or masCha.id.find("Hide")>=0:return 
	var y

#------------------------------------生成信息-------------------------------
	if masCha.lv == 3:
		n = 3
		y = chaData.getLvIds(masCha.id,2)
		# sys.newBaseMsg("","对"+masCha.chaName+"使用了融合解除")
	elif masCha.lv == 2:
		y = chaData.getLvIds(masCha.id,1)
		n = 3
		# sys.newBaseMsg("","对"+masCha.chaName+"使用了融合解除")
	else:
		n = 0

#------------------------------------操作-------------------------------
	if n == 0:
		return

	for i in range(n):
		ch = sys.main.newChara(y)
		sys.main.player.addCha(ch)
		
#------------------------------------移除-------------------------------
	yield(sys.get_tree().create_timer(0.05), "timeout")
	sys.main.delMatChara(masCha)
	sys.main.player.delItem(self)